// 下载文件
export const downFile = (blob, fileName) => {
  if (window.navigator && window.navigator.msSaveOrOpenBlob) {
    window.navigator.msSaveOrOpenBlob(blob, decodeURI(fileName));
  } else {
    var link = document.createElement("a");
    link.href = URL.createObjectURL(blob);
    link.download = decodeURI(fileName);
    document.body.appendChild(link);
    link.click();
  }
};

export const previewFile = (blob, fileName) => {
  if (window.navigator && window.navigator.msSaveOrOpenBlob) {
    window.navigator.msSaveOrOpenBlob(blob, fileName);
  } else {
    let link = document.createElement("a");
    link.href = URL.createObjectURL(blob);
    link.target = "_blank";
    document.body.appendChild(link);
    link.click();
  }
};
export const iosPreviewFile = (blob) => {
  window.location.replace(URL.createObjectURL(blob));
};
